<template>
  <a-spin :spinning="confirmLoading">
    <BasicTable @register="registerTable"></BasicTable>
  </a-spin>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { BasicTable } from '/@/components/Table';
import { list } from '../LabItemsRecordDevice.api';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from '../LabItemsRecordDevice.data';

const emit = defineEmits(['register', 'ok']);
const props = defineProps({ recordId: { type: String } })
const confirmLoading = ref<boolean>(false);
const queryParam = reactive<any>({
  devId:'',
});
const { tableContext } = useListPage({
  tableProps: {
    title: '设备运行记录',
    api: list,
    columns,
    canResize: false,
    useSearchForm: false,
    showIndexColumn: true,
    showActionColumn:false,
    beforeFetch: (params) => {
      queryParam.devId=props.recordId;
      return Object.assign(params, queryParam);
    },
  },
});
const [registerTable, { reload }] = tableContext;
const reloadTable = (devId) =>{
  queryParam.devId = devId;
  reload();
}
defineExpose({
  reload,
  reloadTable,
});
</script>

<style lang="less" scoped>
.antd-modal-form {
  min-height: 500px !important;
  overflow-y: auto;
  padding: 24px 24px 24px 24px;
}
</style>
